﻿using System;
using fastCSharp;

namespace diantou.web.management
{
    /// <summary>
    /// 问题集合
    /// </summary>
    [fastCSharp.code.cSharp.webView(IsPage = false, IsPool = true)]
    partial class problemList : currentUserView<problemList>
    {
        /// <summary>
        /// 问题集合
        /// </summary>
        [fastCSharp.emit.webView.clearMember]
        private onlineJudge.userProblem[] problems;
        /// <summary>
        /// 未审核竞赛数量
        /// </summary>
        protected int newExternalContestCount
        {
            get
            {
                if (currentUser.Permission == dataModel.user.permission.Admin)
                {
                    return diantou.dataAccess.tcpCall.contest.newExternalContestCount;
                }
                return 0;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="page"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        private bool loadView(int page, diantou.dataAccess.problem.showType showType, diantou.dataAccess.problem.problemType problemType, diantou.dataAccess.problem.standardProgramType standardProgramType, diantou.dataAccess.problem.payType payType, int userId)
        {
            diantou.dataAccess.problem[] values;
            values = diantou.dataAccess.clientCache.Problem.Get(diantou.dataAccess.tcpCall.problem.getIds(showType, problemType, standardProgramType, payType, userId, pageInfo.Size = 40, pageInfo.Page = page, currentUserId, out pageInfo.Count));
            if (currentUser.Permission != dataModel.user.permission.Admin)
            {
                int index = 0;
                foreach (diantou.dataAccess.problem value in values) (values[index++] = value.Clone()).BrowseCount = 0;
            }
            problems = values.getArray(value => new onlineJudge.userProblem { Problem = value, User = currentUser });
            return true;
        }
    }
}
